<template>
    <div class="box">
        <div class="goBack" @click="goBack">
            <van-icon name="arrow-left" />
        </div>
        <div class="img">
            <img :src="movieDetail.poster" width="100%" height="201">
        </div>
        <div class="detail">
            <div class="col">
                <div class="moviename">
                    <span class="name">{{ movieDetail.name }}</span>
                    <span class="type">{{ movieDetail.item ? movieDetail.item.name : '' }}</span>
                </div>
                <div class="grades">
                    <span class="grade">{{ movieDetail.grade ? movieDetail.grade : '' }}</span>
                </div>
            </div>
            <div class="movieinfo">{{ movieDetail.category }}</div>
            <div class="movieinfo">{{ movieDetail.nation }} | {{ movieDetail.runtime }}分钟</div>
            <div class="detail">{{ movieDetail.synopsis }}</div>
        </div>
        <div class="actors">
            <div class="actorTitle">演职人员</div>
            <div class="actorList">
                <ul>
                    <li v-for="(actor, index) in movieDetail.actors" :key="index">
                        <img :src="actor.avatarAddress" alt="">
                        <span class="actorName">{{ actor.name ? actor.name : '暂无主演' }}</span>
                        <span class="job">{{ actor.role }}</span>
                    </li>
                </ul>
            </div>
        </div>
        <div class="photos">
            <div class="photoTitle">
                <span class="left">剧照</span>
                <span class="right">全部(5)</span>
            </div>
            <div class="allPhoto">
                <ul>
                    <li v-for="(pic, index) in movieDetail.photos" :key="index">
                        <img :src="pic" alt="">
                    </li>
                </ul>
            </div>
        </div>
        <div class="btn">
            <van-button type="warning" color="orangered" size="large">选座购票</van-button>
        </div>

    </div>
</template>

<script>
import Vue from 'vue';
import { Icon } from 'vant';
import { Button } from 'vant';
import { filmInfo } from '@/request/request'
Vue.use(Button);
Vue.use(Icon);
export default {
    data() {
        return {
            movieDetail: {}
        }
    },
    methods: {
        goBack() {
            this.$router.back();
        }
    },
    created() {
        let id = this.$route.query.filmId
        filmInfo(id).then(res => {
            console.log(res);
            this.movieDetail = res
        })
    }
}
</script>

<style lang="scss" scoped>
.goBack {
    height: 30px;
    width: 30px;
    position: absolute;
    top: 5px;
    left: 5px;
    background-color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
}

.img {
    width: 375px;
    height: 210px;
    overflow: hidden;
}

.detail {
    padding: 15px;
    padding-top: 12px;
    background-color: #fff;
    box-sizing: border-box;

    .col {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: start;
        -ms-flex-pack: start;
        justify-content: flex-start;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;

        .moviename {
            width: 256px;

            .name {
                color: #191a1b;
                font-size: 18px;
                height: 24px;
                line-height: 24px;
                margin-right: 7px;
            }

            .type {
                font-size: 9px;
                color: #fff;
                background-color: #d2d6dc;
                height: 14px;
                line-height: 14px;
                padding: 0 2px;
                border-radius: 2px;
                display: inline-block;
                box-sizing: border-box;
            }
        }

        .grades {
            width: calc(100% - 250px);
            text-align: right;
            color: #ffb232;

            .grade {
                font-size: 18px;
                font-style: italic;
            }
        }

        .movieinfo {
            font-size: 13px;
            color: #797d82;
            margin-top: 4px;
        }

        .detail {
            font-size: 13px;
            color: #797d82;
            margin-top: 4px;
        }
    }

    .movieinfo {
        font-size: 13px;
        color: #797d82;
        margin-top: 4px;
    }

    .detail {
        font-size: 13px;
        color: #797d82;
        margin-top: 4px;
        padding: 0;
    }
}

.actors {
    margin-top: 10px;
    background-color: #fff;

    .actorTitle {
        width: 100%;
        padding: 15px;
        box-sizing: border-box;
    }

    .actorList {
        height: 140px;
        background: rgb(255, 255, 255);
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        height: 200px;

        ul {
            display: flex;
            -webkit-box-pack: start;
            -ms-flex-pack: start;
            justify-content: flex-start;
            position: relative;
            width: 100%;
            margin: 0;
            padding-left: 15px;
            list-style: none;
            box-sizing: border-box;

            li {
                width: 85px;
                min-width: 85px;
                position: relative;
                margin-right: 10px;
                cursor: pointer;
                display: block;
                float: left;
                text-align: center;

                img {
                    width: 85px;
                    height: 85px;
                }

                .actorName {
                    padding-top: 10px;
                    font-size: 12px;
                    color: #191a1b;
                    width: 85px;
                    height: 18px;
                    display: block;
                    overflow: hidden;
                    -o-text-overflow: ellipsis;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    // box-sizing: border-box;
                }

                .job {
                    font-size: 10px;
                    color: #797d82;
                }
            }
        }
    }

    .actorList::-webkit-scrollbar {
        width: 0 !important
    }

    .actorList {
        -ms-overflow-style: none;
    }

    .actorList {
        overflow: -moz-scrollbars-none;
    }
}

.photos {
    margin-top: 10px;
    margin-bottom: 60px;
    background-color: #fff;

    .photoTitle {
        height: 62px;
        width: 100%;
        padding: 15px;
        box-sizing: border-box;

        .left {
            font-size: 16px;
            text-align: left;
            color: #191a1b;
            display: inline-block;
            height: 22.5px;
            line-height: 22px;
        }

        .right {
            font-size: 13px;
            color: #797d82;
            float: right;
            display: inline-block;
            height: 22.5px;
            line-height: 22px;
        }
    }

    .allPhoto {
        height: 115px;
        background: rgb(255, 255, 255);
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        height: 236px;

        ul {
            display: flex;
            -webkit-box-pack: start;
            -ms-flex-pack: start;
            justify-content: flex-start;
            position: relative;
            width: 100%;
            margin: 0;
            padding-left: 15px;
            box-sizing: border-box;
            list-style: none;

            li {
                position: relative;
                margin-right: 10px;
                min-width: 150px;
                cursor: pointer;
                display: block;
                float: left;
                width: 105px;
                width: auto !important;

            }
        }
    }

    .allPhoto::-webkit-scrollbar {
        width: 0 !important
    }

    .allPhoto {
        -ms-overflow-style: none;
    }

    .allPhoto {
        overflow: -moz-scrollbars-none;
    }
}

.btn {
    height: 49px;
    position: fixed;
    bottom: 0px;
    width: 100%;
}

.box {
    overflow: auto;
    width: 100%;
    height: 100%;
    background-color: #f4f4f4;
}</style>
